import { WeElement, define } from 'omi';
import './index.css'

define('disable-picker', class extends WeElement {
  data={}

  choose_change = (evt) => { 
    if(evt.detail.value.includes(evt.currentTarget.dataset.disable)){
      wx.showToast({
        title: '该功能未开放,敬请期待！',
        icon:'none',
        mask:true
      })
    }else{
      this.fire('choosechange', evt.detail.value);
    }

  }

  render(){
    return (
      <picker
        class='pick'
        mode='selector'
        value={this.props.pick.choose}
        range={this.props.pick.text}
        bindchange={this.choose_change}
        data-disable={this.props.pick.disable}
      >{this.props.pick.text[this.props.pick.choose]}</picker>
    )
  }
})